// const { userInfo } = require("os");
const readLine=require("readline");

const rl=readLine.createInterface({
    input:process.stdin,  //输入
    output:process.stdout //输出
})
let arr=["name:","email:","qq:","phone:"];

const userInfo={};
let i=0;
function info(answer){
    switch(i){
        case 0:
            userInfo.name=answer;
            break;
        case 1:
            userInfo.email=answer;
            break;
        case 2:
            userInfo.qq=answer;
            break;
        case 3:
            userInfo.phone=answer;
            break;
    }
    i++;
    if(i<arr.length){
        rl.question(arr[i],info);
    }else{
        console.log("你输入的信息如下")
        console.log(userInfo);
        rl.close();
    }

}
console.log("请输入以下信息")
rl.question(arr[0],info);